<?php

/*
|--------------------------------------------------------------------------
| Admin Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "admin" middleware group. Now create something great!
|
*/

Route::match(['get', 'post'], 'index', 'HomeController@index')->name('home');
Route::get('login', 'LoginController@showLoginForm');
Route::post('login', 'LoginController@login')->name('login');
Route::post('logout', 'LoginController@logout')->name('logout');

// 管理员
Route::resource('admin-users', 'AdminUsersController')->only('index', 'store', 'edit', 'update', 'destroy');
Route::match(['get', 'post'], 'admin-users/{admin_user}/give_permission', 'AdminUsersController@givePermission')->name('admin-users.give_permission');
Route::match(['get', 'post'], 'admin-users/{admin_user}/give_role', 'AdminUsersController@giveRole')->name('admin-users.give_role');

// 管理员权限
Route::resource('admin-permissions', 'AdminPermissionsController')->only('index', 'store', 'edit', 'update', 'destroy');

// 管理员角色
Route::resource('admin-roles', 'AdminRolesController')->only('index', 'store', 'edit', 'update', 'destroy');
Route::match(['get', 'post'], 'admin-roles/{admin_role}/give_permission', 'AdminRolesController@givePermission')->name('admin-roles.give_permission');

// 用户
Route::resource('users', 'UsersController')->only('index', 'store', 'edit', 'update', 'destroy');
Route::match(['get', 'post'], 'users/{user}/give_permission', 'UsersController@givePermission')->name('users.give_permission');
Route::match(['get', 'post'], 'users/{user}/give_role', 'UsersController@giveRole')->name('users.give_role');

// 用户权限
Route::resource('permissions', 'PermissionsController')->only('index', 'store', 'edit', 'update', 'destroy');

// 用户角色
Route::resource('roles', 'RolesController')->only('index', 'store', 'edit', 'update', 'destroy');
Route::match(['get', 'post'], 'roles/{role}/give_permission', 'RolesController@givePermission')->name('roles.give_permission');

// 新闻
Route::resource('news', 'NewsController');
// 上传图片
Route::post('news/{news}', 'NewsController@update')->name('news.update');

// 新闻分类
Route::resource('news-sorts', 'NewsSortsController')->only('index', 'store', 'edit', 'update', 'destroy');

// 古桥
Route::resource('bridges', 'BridgesController');
// 上传图片
Route::post('bridges/{bridge}', 'BridgesController@update')->name('news.update');

// 古桥年代
Route::resource('bridge-ages', 'BridgeAgesController')->only('index', 'store', 'edit', 'update', 'destroy');

// 古桥类型
Route::resource('bridge-types', 'BridgeTypesController')->only('index', 'store', 'edit', 'update', 'destroy');

// 古桥级别
Route::resource('bridge-levels', 'BridgeLevelsController')->only('index', 'store', 'edit', 'update', 'destroy');

//Route::resource('admin-roles', 'AdminRolesController@index');

